import http from '@/Services/Request'

const base = '/api/Comments'

export default {
    /** 获取所有评论 */
    GetAll() {
        return http.get(base)
    },

    /** 根据ID获取评论 */
    GetById(id) {
        return http.get(`${base}/${id}`)
    },

    /** 创建评论 */
    Create(model) {
        return http.post(base, model)
    },

    /** 更新评论 */
    Update(id, model) {
        return http.put(`${base}/${id}`, model)
    },

    /** 删除评论 */
    Delete(id) {
        return http.delete(`${base}/${id}`)
    },

    /** 获取商品的评论 */
    GetProductComments(productId) {
        return http.get(`${base}/product/${productId}`)
    },

    /** 获取用户的评论 */
    GetUserComments(userId) {
        return http.get(`${base}/user/${userId}`)
    }
} 